import './style/index.css';

import { createApp } from 'vue';

import router from './router';


import ElementPlus from 'element-plus';
import 'element-plus/dist/index.css';
import * as ElementPlusIconsVue from '@element-plus/icons-vue';
import {getSettingApi} from "./api/api";

let res = await getSettingApi({});
if (res.code === 0) {
    window.APP_CONFIG = res.data;
}

import App from './App.vue';

const app = createApp(App);



for (const [key, component] of Object.entries(ElementPlusIconsVue)) {
    app.component(key, component)
}

app.use(ElementPlus);
app.use(router);

app.mount('#app');

// 监听来自主进程的导航事件
window.electronAPI.onNavigate((route) => {
    router.push(route);
});

// 监听窗口大小调整事件
// window.electronAPI.onWindowResize((width, height) => {
//     document.body.style.height = `${height}px`;
//     document.body.style.width = `${width}px`;
// });